from django.db import models
# 预约表
from shortuuidfield import ShortUUIDField

from hospital_model.models import DepartmentModel, ProjectModel, TimeModel
from user_model.models import UserModel


# 预约表
class ReservationOrderModel(models.Model):
    GENDER_CHOICES = (
        (u'0', u'正常'),
        (u'1', u'注销'),
    )
    r_id = ShortUUIDField(primary_key=True, verbose_name="预约id")
    r_order_number = models.CharField(max_length=20, unique=True, verbose_name="订单编号")
    reservation_number = models.CharField(max_length=3, verbose_name='预约次数')
    r_IDcard = models.CharField(max_length=18, blank=True, null=True, verbose_name="身份证")
    project_id = models.CharField(max_length=128, verbose_name='预约项目')
    r_time = models.CharField(max_length=32, verbose_name='预约时间')
    r_data = models.CharField(max_length=32, verbose_name='预约日期')
    r_status = models.CharField(max_length=2, choices=GENDER_CHOICES, default='0', verbose_name="是否到检")
    r_number = models.CharField(max_length=3, default=0, verbose_name='取消次数')

    class Meta:
        db_table = 'reservation_order'
        verbose_name = '预约订单表'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.project_id


# 统计表
class StatisticsModel(models.Model):
    s_id = ShortUUIDField(primary_key=True, verbose_name="统计表id")
    project_id = models.CharField(max_length=128, verbose_name='预约项目')
    date_id = models.CharField(max_length=128, verbose_name='日期')
    time = models.CharField(max_length=128, verbose_name='时间点')
    number = models.CharField(max_length=6, verbose_name='已预约人数')

    class Meta:
        db_table = 'statistics'
        verbose_name = '预约表'
        verbose_name_plural = verbose_name
